package reflect;

import java.lang.reflect.Method;

/**
 * 通过反射机制访问注解的参数
 */
public class ReflectDemo11 {
    public static void main(String[] args) throws Exception {
        Class<?> cls = Class.forName("reflect.Person");
        Method method = cls.getDeclaredMethod("sayHello");
        if (method.isAnnotationPresent(AutoRunMethod.class)){
            AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            System.out.println(arm.name()+arm.value());
        }
    }
}
